<%@ page import="com.casework.LegalCase" %>
<!doctype html>
<html>
<head>
    <meta name="layout" content="main">
    <g:set var="entityName" value="${message(code: 'legalCase.label', default: 'Case')}"/>
    <title><g:message code="default.list.label" args="[entityName]"/></title>
</head>

<body>
<a href="#list-legalCase" class="skip" tabindex="-1"><g:message code="default.link.skip.label"
                                                                default="Skip to content&hellip;"/></a>
<sec:ifAllGranted roles="ROLE_ADMIN">
<div class="nav" role="navigation">
    <ul>
        <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
        <li><g:link class="create" action="create"><g:message code="default.new.label"
                                                              args="[entityName]"/></g:link></li>
    </ul>
</div>
</sec:ifAllGranted>

<div id="list-legalCase" class="content scaffold-list" role="main">
    <h1><g:message code="default.list.label" args="[entityName]"/></h1>
    <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
    </g:if>
    <table>
        <thead>
        <tr>

            <g:sortableColumn property="ecNumber"
                              title="${message(code: 'legalCase.ecNumber.label', default: 'EC Number')}"/>


            <g:sortableColumn property="phase" title="${message(code: 'legalCase.phase.label', default: 'Phase')}"/>

            <g:sortableColumn property="decisionDate"
                              title="${message(code: 'legalCase.decisionDate.label', default: 'Decision Date')}"/>


            <th>Competition Concern</th>
        </tr>
        </thead>
        <tbody>
        <g:each in="${legalCaseInstanceList}" status="i" var="legalCaseInstance">
            <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

                <td>
                    <g:link action='show' id="${legalCaseInstance.id}">M.${legalCaseInstance.ecNumber}</g:link>
                </td>

                <td>${fieldValue(bean: legalCaseInstance, field: "phase")}</td>

                <td>${fieldValue(bean: legalCaseInstance, field: "decisionDate")}</td>

                <td>${fieldValue(bean: legalCaseInstance, field: "competitionConcern")}</td>

            </tr>
        </g:each>
        </tbody>
    </table>

    <div class="pagination">
        <g:paginate total="${legalCaseInstanceTotal}"/>
    </div>
</div>
</body>
</html>
